feat(#109): -verify matcher for hash verification - #428
Merged
Conversation
Add the `-verify EXPECTED` predicate: TRUE when the file's computed digest
equals EXPECTED, a {field} template rendered per entry - the manifest-
verification companion of -hash. So:
xff . -type f -verify {def.SUMS} # list files matching their manifest
xff . -type f ! -verify {def.SUMS} # list drift / corruption
`-verify=ALGO[/ENCODING]` shares the -hash spec grammar (sha256/hex default;
sha1/sha512/md5, hex/base64); hex comparison folds case (sha256sum lowercases,
SRI-style tools upper-case) while base64 stays case-sensitive. Style::kXff, so
the find style rejects it; a bad spec is a pre-walk usage error.
Wiring mirrors -cmp (arity-1 field-template target) + -hash (kHash binding);
the parser's kHash =SPEC branch now consumes the descriptor's arity operands
so `-verify=sha256 EXPECTED` parses. ValidateHashArgs covers -verify too.
Tests: xff/cli/verify_test.sh (match/mismatch, {def.X} source, hex case-fold,
ALGO/ENCODING selectors, `! -verify` drift, bad-spec + find-style errors).
Regenerated XFF.md; CHANGELOG + TODO updated. --summary tallies deferred to a
follow-up slice.
helly25
enabled auto-merge (squash)
August 9, 2026 21:24
helly25
disabled auto-merge
August 9, 2026 21:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
-verify EXPECTEDmatcher (#109) - the manifest-verification companion of-hash.What
-verify EXPECTEDis a predicate: true when the file's computed digest equals EXPECTED, a{field}template rendered per entry.{def.X}value, a{capture.X}, or a literal), so no bespoke manifest parser is needed - a sidecar-manifest reader can later just populate{def.X}.-verify=ALGO[/ENCODING]shares the-hashspec grammar (sha256/hex default; sha1/sha512/md5, hex/base64).Style::kXff, so the find style rejects it; a bad spec is a pre-walk usage error (exit 2).How
Wiring mirrors
-cmp(arity-1 field-template target) +-hash(Binding::kHash). The parser'skHash=SPECbranch now consumes the descriptor's arity operands (previously hard-coded arity 0), so-verify=sha256 EXPECTEDparses;ValidateHashArgscovers-verifytoo.Test
xff/cli/verify_test.sh: match/mismatch,{def.X}source, hex case-fold, ALGO/ENCODING selectors,! -verifydrift, bad-spec + find-style usage errors.bazel test //xff/... --config=clang: 89 pass. clang-tidy clean; XFF.md regenerated.Follow-up slice (tracked in TODO #109):
--summarytallies of verified vs failed and--summary=hashdedup grouping.